package com.example.live.util;

import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Random;

public class CommonUtils {

    public static Random random;
    static {
        try {
            random = SecureRandom.getInstanceStrong();
        }catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
    }

    public static String getRandomString(int length) {
        String code = String.format("%04d", random.nextInt(length));
        return code;
    }

}
